
from flask import request
from . import app_user
from conn_mysql import MysqlApi


@app_user.route('/login', methods=['POST'])
def login():

    phone = request.form.get('phone')
    pass_word = request.form.get('pass_word')

    if not all([phone, pass_word]):

        return {
                "status": -1,
                "errorCode": 1,
                "errorMsg": '账号或密码不能为空',
                "resultBody": None,
            }

    with MysqlApi() as m:

        result = m.login_notify(phone, pass_word)

    return result